import 'dart:convert';

import 'package:enterprise_v6_app/app/data/common/choice_bean.dart';
import 'package:enterprise_v6_app/generated/json/base/json_field.dart';
import 'package:enterprise_v6_app/generated/json/role_personnel_entity.g.dart';

export 'package:enterprise_v6_app/generated/json/role_personnel_entity.g.dart';

@JsonSerializable()
class RolePersonnelEntity extends ChoiceBean {
  RolePersonnelEntity();

  factory RolePersonnelEntity.fromJson(Map<String, dynamic> json) => $RolePersonnelEntityFromJson(json);

  /// 昵称
  String? nickName = '';
  String? userId = '';
  String? userName = '';

  Map<String, dynamic> toJson() => $RolePersonnelEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  String getId() {
    return userId ?? '';
  }

  @override
  String getShowName() {
    if (nickName!.isEmpty) {
      return userName!;
    }
    return nickName!;
  }

}
